<?php

namespace App\Http\Controllers;

use App\CompetitionsSignup;
use Illuminate\Http\Request;
use App\Competition;
use App\User;

class CompetitionSignupController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index($id)
    {
        $signlist = Competition::find($id)->signlist;
        $title = Competition::find($id)->title;
        foreach ($signlist as $key) {
            $key->gender = User::find($key->user_id)->gender;
            $key->birthdate = User::find($key->user_id)->birthdate;
            $key->tel = User::find($key->user_id)->tel;
            $key->username = User::find($key->user_id)->real_name;
        }

        return view('competitions.signup_list',compact(['signlist','title']));
    }

}
